package main

import (
	"database/sql"
)

type ModelInterface interface {
	Init() error
	Close()
	Sql() *sql.DB
	GetAllPosts() ([]*PostData, error)
	GetPosts(int) ([]*PostData, error)
	GetPostsCnt() (int, error)
	GetPostsByTag(string, int) ([]*PostData, error)
	GetPostsCntByTag(string) (int, error)
	GetPostById(int) (*PostData, error)
	GetAllTags() ([]*TagData, error)
	SetTag(string, string) error
	GetAllPlugins() ([]*PluginData, error)
	GetPluginByName(string) (*PluginData, error)
	SavePlugin(*PluginData) error
	SetPluginData(string, string) error
	SavePost(*PostData) error
	GetAllConfig() (map[string]string, error)
	GetConfig(string) (string, error)
	SetConfig(string, string) error
}

type PostData struct {
	Pid      int
	Title    string
	Content  string
	Created  int64
	Modified int64
	Tags     []string
}

type TagData struct {
	TagName string
	PostCnt int
}

type PluginData struct {
	Name    string
	Enabled bool
	Data    string
}
